<?php

/**
 * Parroquia form.
 *
 * @package    cronos-doctrine
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ParroquiaForm extends BaseParroquiaForm
{
  public function configure()
  {
      unset(
        $this['created_at'],
        $this['updated_at']
      );
      
      $this->widgetSchema['empresa_id'] = new sfWidgetFormInputHidden(array(),array('value'=> sfContext::getInstance()->getUser()->getAttribute('agente_user_empresa_id')));
      
      //$this->widgetSchema['pais_id'] = new sfWidgetFormInputHidden(array(),array('value'=> 1));

       $this->widgetSchema['pais_id'] = new sfWidgetFormDoctrineChoice(array(
                    'model'     => 'Pais',
      ));
      
      $this->widgetSchema['entidad_id'] = new sfWidgetFormDoctrineDependentSelect(array(
	            'model'     => 'Entidad',
                    'depends'   => 'Pais',
                    'table_method' => 'getNombre',
                    'add_empty' => 'Seleccione Entidad',
      ));

      $this->widgetSchema['municipio_id'] = new sfWidgetFormDoctrineDependentSelect(array(
	            'model'     => 'Municipio',
                    'depends'   => 'Entidad',
                    'add_empty' => 'Seleccione Municipio',
                    'table_method' => 'getNombre',
                    'order_by' => array('nombre','asc')
      ));
      
      
      
       $this->widgetSchema['zona_id'] = new sfWidgetFormDoctrineChoice(array(
         'multiple' => false, 
         'model' => 'Zona',
         'query' => Doctrine_Query::create()->select('m.id, m.nombre')->from('Zona m')->where('m.empresa_id = '.sfContext::getInstance()->getUser()->getAttribute('agente_user_empresa_id') )->orderBy('m.nombre asc'),
         'expanded' => false));
       

      $this->widgetSchema['nombre'] = new sfWidgetFormInputText(array(),array('placeholder'=>'Nombre de la colonia', 'style'=>'width:450px;'));
   
  }
}
